CC=gcc
LINKFLAGS=-lpthread
NAME=ra_flcontcent
OBJECTS = main.o rafcc_settings.o ra_strings.o ra_logfile.o
HEADERS = ra_flcontcent.h rafcc_settings.h

all: $(NAME)
	sudo ./$(NAME) start
	sudo ./$(NAME) stop

ra_flcontcent: $(OBJECTS) ra_flcontcent.conf
	$(CC) $(LINKFLAGS) -g $(OBJECTS) -o $(NAME)
	cp ra_flcontcent.conf /etc/ra_flcontcent.conf

main.o: main.c $(HEADERS)
	$(CC) -g -c -o main.o main.c
	chmod 600 /etc/ra_flcontcent.conf

rafcc_settings.o: rafcc_settings.c rafcc_settings.h
	$(CC) -g -c -o rafcc_settings.o rafcc_settings.c	

ra_strings.o: ra_strings.c
	$(CC) -g -c -o ra_strings.o ra_strings.c

ra_logfile.o: ra_logfile.c
	$(CC) -g -c -o ra_logfile.o ra_logfile.c
	
clean:
	rm $(NAME) $(OBJECTS)

norun: $(NAME) ra_flcontcent.conf
	